using System.Threading.Tasks;
using JoyfulHomeJourney.BackEnd.Infrastructure.Dtos.Requests.Objects;
using JoyfulHomeJourney.BackEnd.Server.Instances;
using JoyfulHomeJourney.BackEnd.Server.Interfaces;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace JoyfulHomeJourney.BackEnd.Api.Admin.Controllers
{
	[TypeFilter(typeof(CheckLoginFilter), Arguments = new object[] { "admin" })]
	public class VipDeductionsController : BaseController
	{
		private readonly IVipDeductionsServer _vipDeductionsServer;
		public VipDeductionsController(IVipDeductionsServer vipDeductionsServer)
		{
			_vipDeductionsServer = vipDeductionsServer;
		}
		/// <summary>
		/// 添加
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		[HttpPost]
		public async Task<IActionResult> Add(RequestVipDeductionsDto dto)
		{
			return Send(await _vipDeductionsServer.AddAsync(dto));
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		[HttpPost]
		public async Task<IActionResult> Delete(RequestVipDeductionsDto dto)
		{
			return Send(await _vipDeductionsServer.DeleteAsync(dto));
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		[HttpPost]
		public async Task<IActionResult> Update(RequestVipDeductionsDto dto)
		{
			return Send(await _vipDeductionsServer.UpdateAsync(dto));
		}
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        [HttpGet]
		public async Task<IActionResult> Pagination(int page,int limit)
		{
			return Send(await _vipDeductionsServer.PaginationAsync(page,limit));
		}
        /// <summary>
        /// 单个查询
        /// </summary>
        /// <param id="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_dg_Dedvount(string id)
        {
            return Send(await _vipDeductionsServer.Get_dg_Dedvount(id));
        }
    }
}
